
import ReactBox from 'grey-react-box';
import State from './State';
import sceneAdd from './fns/sceneAdd';
import sceneRem from './fns/sceneRem';
import updateRendererSize from './fns/updateRendererSize';
import saveData from './fns/saveData';
import recover from './fns/recover';

export { default as State } from './State';

export default class Controller extends ReactBox<State>{

    constructor() {
        super(new State());
    }

    /** 更新渲染器尺寸 */
    updateRendererSize = this.pipeline<any>(updateRendererSize);

    /** 添加原件到舞台 */
    sceneAdd = this.pipeline(sceneAdd);

    /** 把原件从舞台移除 */
    sceneRem = this.pipeline(sceneRem);

    /** 获取当前可以存储的状态 用于【recover】 */
    saveData = this.pipeline(saveData);

    /** 回复一个状态，数据来源 【getSaveData】 */
    recover = this.pipeline(recover)
}